package com.atguigu.gmall.weball.controller;

import com.atguigu.gmall.feign.order.OrderFeignClient;
import com.atguigu.gmall.model.order.vo.OrderConfirmVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @Author:lyd
 **/
@Controller
public class OrderController {

    @Autowired
    OrderFeignClient orderFeignClient;

    @GetMapping("/trade.html")
    public String trade(Model model){

        //远程调用订单服务获取订单交易信息
        OrderConfirmVo data = orderFeignClient.orderConfirm().getData();
        model.addAttribute("detailArrayList",data.getDetailArrayList());
        model.addAttribute("totalNum",data.getTotalNum());
        model.addAttribute("totalAmount",data.getTotalAmount());
        model.addAttribute("userAddressList",data.getUserAddressList());
        model.addAttribute("tradeNo",data.getTradeNo());
        return "order/trade";
    }

    @GetMapping("/myOrder.html")
    public String myOrder(){


        return "order/myOrder";
    }
}
